﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Prism.PubSubEvents;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;
using 示例.Models;

namespace 示例
{
    public static class 小冰
    {

        public static string 当前目录
        {
            get { return AppDomain.CurrentDomain.BaseDirectory; }
        }

        public static string 配置文件路径
        {
            get { return 当前目录 + Properties.Settings.Default.配置文件名称; }
        }

        public static Window 主窗口
        {
            get { return Application.Current.MainWindow; }
        }

        public static void LoadViewModel(this IView 视图1)
        {
           ViewModelLocationProvider.AutoWireViewModelChanged(视图1);
        }

        public static void Set默认解析器()
        {
            ViewModelLocationProvider.SetDefaultViewModelFactory(
                T => 人事部.Resolve(T)); ;
        }

        public static IUnityContainer 人事部
        {
            get
            {
                return ServiceLocator.Current.GetInstance<IUnityContainer>();
            }
        }
        public static IEventAggregator 新闻部
        {
            get
            {
                return 人事部.Resolve<IEventAggregator>();
            }
        }
        public static Dispatcher Ui线程
        {
            get { return Application.Current.Dispatcher; }
        }
        public static 系统配置 系统配置1 { get; set; }
    }
}
